//
// Project Kimchi
//
// Copyright IBM Corp, 2015-2016
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
//     http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
//

/* Create Guest Modal */

.guests-modal {
    .modal-dialog {
        width: 1100px;
    }
    .page-list {
        position: absolute;
        left: 0;
        right: 0;
        top: 0;
        bottom: 0;
        overflow: hidden;
    }
    .page {
        position: absolute;
        left: 0;
        width: 100%;
        height: 100%;
        overflow: auto;
        padding: 10px 30px;
    }
    .template-status {
        position: absolute;
        right: 15px;
        bottom: 15px;
        font-size: 32px;
    }
}

#wok-confirm-modal .modal-body strong,
.modal-dialog .modal-body strong {
    border-bottom: 1px dotted;
}

#guest-add-window {
    .modal-body {
        margin: 0;
        padding: 0;
    }
    .modal-footer {
        margin-top: 0;
    }
    .modal-footer .btn + .btn {
        margin-left: 0;
    }
    .modal-footer .btn {
        margin-right: 5px;
    }
    .modal-dialog {
        width: 900px;
    }
    .guest-modal-container {
        padding: 10px 30px;
        position: relative;
    }
    .guest-pager {
        background: $table-border-color;
        overflow: hidden;
        position: relative;
        height: 530px;
    }
    &.modal-content p {
        margin: 0 0 10px 0;
    }
    &.modal-content h5 {
        font-size: 13pt;
        font-weight: 400;
        margin-top: 0;
    }
    &.modal-content label {
        font-size: 16px;
        font-weight: 400;
        font-family: $font-family-sans-serif;
    }
    form#form-vm-add {
        margin: 0;
    }
    input#guest-vm-name,
    p.help-block {
        width: 592px;
    }
}

#guest-content-container {
    .wok-guest-list {
        display: block;
        width: 100%;
        padding: 0;
        list-style-type: none;
        .wok-guest-list-body > ul {
            list-style: none;
            padding: 0;
            > li:nth-child(even) {
                background-color: #fcfcfc;
            }
            > li:nth-child(odd) {
                background-color: #fff;
            }
            > li:first-child {
                border-top: 0;
            }
        }
        .wok-guest-list-header {
            border-top: 0 none;
            height: 36px;
            > span {
                height: 36px;
                padding: 6px 2px;
                display: inline-block;
                vertical-align: middle;
                font-family: $font-family-sans-serif;
                font-weight: 300;
                font-size: 12.5pt;
                line-height: 1.42857;
                border-bottom: none;
                border-top: 0;
                overflow: hidden;
                > span {
                    width: 100%;
                    overflow: hidden;
                    white-space: nowrap;
                    text-overflow: ellipsis;
                    display: block;
                }
            }
        }
        .wok-guest-list-item {
            border-top: 1px solid $table-border-color;
            > span {
                padding: 6px 2px;
                display: inline-block;
                vertical-align: middle;
                font-family: $font-family-sans-serif;
                font-size: 12.5pt;
                line-height: 2.42857;
                font-weight: 400;
            }
            .nodata,
            .screenshot {
                display: none;
            }
            .column-name.distro-icon {
                background: none;
            }
            .progress {
                display: inline-block;
                width: 60%;
                position: relative;
                vertical-align: top;
                margin-top: 15px;
                border-radius: 0;
                -webkit-box-shadow: none;
                box-shadow: none;
            }
            .progress-bar {
                position: absolute;
                top: 0;
                left: 0;
                -webkit-box-shadow: none;
                box-shadow: none;
                &.dark-grey {
                    background-color: map-get($guestCharts, darkGray);
                }
                &.medium-grey {
                    background-color: map-get($guestCharts, mediumGray);
                }
                &.light-grey {
                    background-color: map-get($guestCharts, lightGray);
                }
            }
            .column-type {
                padding-left: 40px;
            }
            .column-actions .btn {
                margin-top: 6px;
            }
            div.percentage-label {
                display: inline-block;
                width: 25%;
                margin-top: 6px;
            }
            div.measure-label {
                display: inline-block;
                width: 35%;
                margin-top: 6px;
            }
            .item-hidden {
                display: none;
            }
            .btn .guest-state {
                display: none;
            }
        }
    }
    .wok-guest-gallery {
        list-style: none;
        padding: 0 0 0 5px;
        > li.wok-guest-list-header {
            display: none;
        }
        > li > ul {
            list-style: none;
            padding: 0;
        }
        .wok-guest-list-item {
            padding: 0;
            width: 290px;
            height: 435px;
            display: inline-block;
            border: 0;
            background: $body-bg;
            margin-right: 20px;
            margin-bottom: 20px;
            position: relative;
            vertical-align: top;
            &.inactive {
                .progress,
                .item-hidden,
                [class^="column-"] {
                    display: none;
                }
                .nodata {
                    display: block;
                    padding-top: 115px;
                    padding-bottom: 115px;
                    text-align: center;
                }
                span.column-action,
                span.column-name {
                    display: block !important;
                }
                .btn {
                    background: #4d4c4e !important;
                }
            }
            > span {
                display: inline-block;
                width: 100%;
                font-family: $font-family-sans-serif;
                font-size: 12.5pt;
                line-height: $line-height-base;
                font-weight: 400;
            }
            .progress {
                display: block;
                float: right;
                width: 125px;
                height: 18px;
                position: relative;
                vertical-align: top;
                margin-top: 0;
                margin-bottom: 0;
                border-radius: 0;
                -webkit-box-shadow: none;
                box-shadow: none;
            }
            .progress-bar {
                position: absolute;
                top: 0;
                left: 0;
                -webkit-box-shadow: none;
                box-shadow: none;
                &.dark-grey {
                    background-color: map-get($guestCharts, darkGray);
                }
                &.medium-grey {
                    background-color: map-get($guestCharts, mediumGray);
                }
                &.light-grey {
                    background-color: map-get($guestCharts, lightGray);
                }
            }
            .item-hidden {
                clear: both;
                display: block;
                white-space: nowrap;
                overflow: hidden;
                text-overflow: ellipsis;
                position: relative;
                top: -10px;
            }
            .column-action.pull-right {
                position: absolute;
            }
            .ul-body {
                display: inline-block;
                padding: 0;
                margin: 0;
                list-style: none;
            }
            .column-type,
            .nodata,
            .column-vnc,
            .column-state {
                display: none;
            }
            .column-name {
                line-height: 2.5 !important;
                font-size: 15.3pt !important;
                font-weight: 500 !important;
                text-overflow: ellipsis !important;
                overflow: hidden !important;
                padding-right: 35px !important;
                padding-left: 20px;
                margin-right: 20px;
                display: block;
                width: 290px;
                white-space: nowrap;
                cursor: default;
            }
            .column-processors,
            .column-memory,
            .column-storage,
            .column-network {
                margin-top: 14px;
                display: block;
                height: 38px;
                padding-left: 20px;
                padding-right: 18px;
            }
            .column-processors {
                margin-top: 18px !important;
            }
            .percentage-label,
            .measure-label {
                float: left;
                display: block;
                width: 68px;
                font-size: 21px;
                font-weight: 600;
                top: -7px;
                position: relative;
            }
            .font-bold {
                font-weight: bold !important;
            }
            .pull-right {
                float: none !important;
            }
            .dropdown-menu {
                width: 100%;
            }
            .screenshot {
                width: 100%;
                height: 148px;
                background-size: cover;
                background-repeat: no-repeat;
            }
            .menu-flat {
                width: 290px;
            }
            .btn {
                width: 100%;
                text-align: left;
                padding-left: 21px;
                border-radius: 0;
                background: rgba(0, 0, 0, .6) !important;
                > span.guest-state {
                    .fa {
                        margin-right: 10px;
                    }
                }
                > span.guest-state.running {
                    span.running {
                        display: block;
                    }
                    span.shutoff,
                    span.starting,
                    span.crashed,
                    span.nostate,
                    span.paused,
                    span.pmsuspended,
                    span.resetting {
                        display: none;
                    }
                }
                > span.guest-state.shutoff {
                    span.shutoff {
                        display: block;
                    }
                    span.running,
                    span.starting,
                    span.crashed,
                    span.nostate,
                    span.paused,
                    span.pmsuspended,
                    span.resetting {
                        display: none;
                    }
                }
                > span.guest-state.starting {
                    span.starting {
                        display: block;
                    }
                    span.running,
                    span.shutoff,
                    span.crashed,
                    span.nostate,
                    span.paused,
                    span.pmsuspended,
                    span.resetting {
                        display: none;
                    }
                }
                > span.guest-state.crashed {
                    span.crashed {
                        display: block;
                    }
                    span.running,
                    span.shutoff,
                    span.starting,
                    span.nostate,
                    span.paused,
                    span.pmsuspended,
                    span.resetting {
                        display: none;
                    }
                }
                > span.guest-state.nostate {
                    span.nostate {
                        display: block;
                    }
                    span.running,
                    span.shutoff,
                    span.starting,
                    span.crashed,
                    span.paused,
                    span.pmsuspended,
                    span.resetting {
                        display: none;
                    }
                }
                > span.guest-state.paused {
                    span.paused {
                        display: block;
                    }
                    span.running,
                    span.shutoff,
                    span.starting,
                    span.crashed,
                    span.nostate,
                    span.pmsuspended,
                    span.resetting {
                        display: none;
                    }
                }
                > span.guest-state.pmsuspended {
                    span.pmsuspended {
                        display: block;
                    }
                    span.running,
                    span.shutoff,
                    span.starting,
                    span.crashed,
                    span.nostate,
                    span.paused,
                    span.resetting {
                        display: none;
                    }
                }
                > span.guest-state.resetting {
                    span.resetting {
                        display: block;
                    }
                    span.running,
                    span.shutoff,
                    span.starting,
                    span.crashed,
                    span.nostate,
                    span.paused,
                    span.pmsuspended {
                        display: none;
                    }
                }
            }
            .guest-actions {
                display: none;
            }
            .guest-state {
                display: block;
            }
        }
    }
    .wok-guest-list .wok-guest-list-body .wok-guest-list-item,
    .wok-guest-gallery .wok-guest-list-body .wok-guest-list-item {
        > span.column-processors {
            > div > div.progress-bar.cpu-progress-bar {
                background-color: #d9182d;
            }
        }
        > span.column-memory {
            > div > div.progress-bar.memory-progress-bar {
                background-color: #008abf;
            }
        }
        > span.column-storage {
            > div > div.progress-bar.storage-progress-bar {
                background-color: $state-warning-border;
            }
        }
        > span.column-network {
            > div > div.progress-bar.network-progress-bar {
                background-color: #7f1c7d;
            }
        }
    }
    .wok-guest-list .wok-guest-list-body .wok-guest-list-item > span.column-state {
        > span.guest-state.running {
            span.running {
                display: block;
            }
            .fa {
                color: $fa-green;
            }
        }
        > span.guest-state.pmsuspended {
            span.pmsuspended {
                display: block;
            }
            .fa {
                color: $gray-light;
            }
        }
        > span.guest-state.nostate {
            span.nostate {
                display: block;
            }
            .fa {
                color: $gray-light;
            }
        }
        > span.guest-state.crashed {
            span.crashed {
                display: block;
            }
            .fa {
                color: $gray-light;
            }
        }
        > span.guest-state.shutdown,
        > span.guest-state.blocked,
        > span.guest-state.shutoff {
            span.shutoff,
            span.blocked,
            span.shutdown {
                display: block;
            }
            .fa {
                color: $gray-light;
            }
        }
        > span.guest-state.starting {
            span.starting {
                display: block;
            }
            .fa {
                color: $gray-light;
            }
        }
        > span.guest-state.paused {
            span.paused {
                display: block;
            }
            .fa {
                color: $gray-light;
            }
        }
        > span.guest-state.resetting {
            span.resetting {
                display: block;
            }
            .fa {
                color: $fa-green;
            }
        }
    }
    .wok-guest-list .wok-guest-list-header,
    .wok-guest-list .wok-guest-list-body .wok-guest-list-item {
        > span.column-state {
            width: 40px;
            text-align: center;
            > span.guest-state {
                font-size: 22px;
                position: relative;
                span.text-status {
                    display: none;
                }
            }
            > span.guest-state span {
                display: none;
            }
        }
        > span.column-name {
            width: 13.7%;
            overflow: hidden;
            white-space: nowrap;
            text-overflow: ellipsis;
            @media (min-width: $screen-lg + 130) {
                width: 9.7%;
            }
            @media (min-width: $screen-xlg) {
                width: 12%;
            }
        }
        > span.column-type {
            width: 11.74%;
            background-position: 0 50%;
            text-overflow: ellipsis;
            overflow: hidden;
            white-space: nowrap;
            @media (min-width: $screen-lg + 130) {
                width: 10.74%;
            }
        }
        > span.column-vnc {
            display: none;
            > a {
                font-weight: normal;
                color: $vnc-blue !important;
            }
            .fa-spin {
                display: none
            }
            .fa-spin.active {
                display: inline-block;
                margin-right: 8px;
                font-size: 22px;
                color: $vnc-blue !important;
            }
            @media (min-width: $screen-lg + 130) {
                width: 10%;
                display: inline-block;
            }
        }
        > span.column-processors,
        > span.column-memory,
        > span.column-storage,
        > span.column-network {
            width: 13%;
        }
        > span.column-action {
            width: 165px;
        }
        > span.item-hidden {
            display: none !important;
        }
        .btn .guest-pending {
            margin-left: -38px;
            margin-right: -45px;
        }
    }
    .wok-guest-list .distro-icon.inactive {
        -webkit-filter: grayscale(100%) contrast(0.8) brightness(110%);
        -moz-filter: grayscale(100%) contrast(0.8) brightness(110%);
        filter: grayscale(100%) contrast(0.8) brightness(110%);
    }
    .wok-guest-list .wok-guest-list-body.inactive {
        color: $disabled-color !important;
    }
    .distro-icon {
        background-color: transparent;
        background-size: 32px 32px;
        background-repeat: no-repeat;
        background-position: 100% 50%;
        &.icon-centos {
            background-image: url('../images/icon-centos.png');
        }
        &.icon-debian {
            background-image: url('../images/icon-debian.png');
        }
        &.icon-fedora {
            background-image: url('../images/icon-fedora.png');
        }
        &.icon-opensuse {
            background-image: url('../images/icon-opensuse.png');
        }
        &.icon-sles {
            background-image: url('../images/icon-sles.png');
        }
        &.icon-ubuntu {
            background-image: url('../images/icon-ubuntu.png');
        }
        &.icon-gentoo {
            background-image: url('../images/icon-gentoo.png');
        }
        &.icon-unknown {
            background-image: url('../images/icon-vm.png');
        }
    }
}

body.wok-gallery {
    background: $input-bg-disabled;
}
